Note: There are often multiple ways to answer each question.

  1. Create a vector of integers from -5 to 10 (inclusive) and assign it to the variable x.

  2. Create a vector which consists of the first 10 multiples of 3 (i.e. 3, 6, …, 30) and assign it to the variable y.

  3. What is the result of x + y? Why does R return this result?

  4. What is the result of z <- c(1, 2, "3")? Why does R return this result?

  5. Create the following list:

person <- list(name = "John Doe",
               age = 26,
               classes = c("ENG", "MAT", "SCI", "SPA", "MUS"))

What is the result of person$classes[2]? Why does R return this result?

  1. What code can I use to find out how many classes John Doe took?

  2. Load the vehicles dataset that we used in class. How many rows and columns are there in this dataset? What are the column names?

  3. What is the highest hwy value?

  4. How many of each value are there in the cyl column?

  5. What is the mean, median and standard deviation of the cty column?